<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>

<h:body>
<h:graphicImage value="/images/image.jpg" />
<h:form>

    <p:growl id="messages"/>
    <p:menubar>
        <p:menuitem value="início" icon="ui-icon-document" url="Inicio.xhtml">
        </p:menuitem>
         <p:submenu label="Cadastros" icon="ui-icon-document">
            <p:menuitem value="Professor" url="" />
            <p:menuitem value="Turma" url="cadastrarTurmas.xhtml" />
            <p:separator />
        </p:submenu>
        <p:submenu label="Modelos" icon="ui-icon-gear">
         <p:menuitem value="Modelos Turmas" url="Turmas.xhtml">
            </p:menuitem>
            <p:menuitem value="Cadastrar Modelos" url="CadastrarModelo.xhtml">
            </p:menuitem>
        </p:submenu>
    </p:menubar>
</h:form>
<br/>
<br/>
<center>
<h1>Turmas</h1>
<br/>
<br/>

</center>
<br/>
<center>
<h:form>

<p:dataTable id="tabela" var="turmas" value="#{cadastroTurmaMB.turmas}">
<p:column headerText="Modelos">
		<p:selectOneMenu value="#{cadastroTurmaMB.nomeModelo}" effect="fade">
            <f:selectItems value="#{cadastroTurmaMB.modelos}" var="m" itemLabel="#{m.descricao}" itemValue="#{m.descricao}"/>
            <f:ajax><f:setPropertyActionListener target="#{cadastroTurmaMB.setNomeModelo()}" value="#{m.descricao}" /></f:ajax>
        </p:selectOneMenu>  
	</p:column>
	<p:column headerText="Descrição">
		#{turmas.descricao}
	</p:column>
	<p:column headerText="Curso">
		#{turmas.curso}
	</p:column>
	<p:column>
		<h:outputText value="Senha: " />
		<h:inputText value="#{modeloSelecionadoBean.cod}" />
		<p:commandButton value="Entrar" action="#{modeloSelecionadoBean.getPag()}" ajax="false">
		 <f:setPropertyActionListener value="#{cadastroTurmaMB.modeloSelecionado}" target="#{modeloSelecionadoBean.model}" />
		 <f:setPropertyActionListener value="#{cadastroTurmaMB.turma.codigoAcesso}" target="#{modeloSelecionadoBean.codAcesso}" />
		</p:commandButton>
	</p:column>
</p:dataTable>
</h:form>
</center>
<center>
<br/>
<h:outputText value="#{modeloSelecionadoBean.erro}" style="color: red;" />
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

<br/>
<br/>
</center>	
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
				 <p:menubar autoDisplay="false">
       
    </p:menubar>
</h:body>
</html>